-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dev - Fix the flaky test in WC_Payments_Incentives_Service_Test #10472
dev - Fix the flaky test in WC_Payments_Incentives_Service_Test #10472
Conversation
Test the buildOption 1. Jetpack Beta
Option 2. Jurassic Ninja - available for logged-in A12s🚀 Launch a JN site with this branch 🚀 ℹ️ Install this Tampermonkey script to get more options. Build info:
Note: the build is updated when a new commit is pushed to this PR. |
Size Change: 0 B Total Size: 1.29 MB ℹ️ View Unchanged
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The change looks good! I could not replicate the initial issue locally, but this is similar to other issues I was experiencing a couple of days ago in a separate repo, and my fix was similar.
Fixes the following error as seen in
https://github.com/Automattic/woocommerce-payments/actions/runs/13581864590/job/37969236625
Changes proposed in this Pull Request
This PR fixes the flaky test
test_get_connect_incentive_has_orders_is_cached_longer_when_has_orders
inWC_Payments_Incentives_Service_Test
that was failing intermittently due to timing precision issues. The test was asserting an exact match for cache expiration time (60 days in seconds), but due to the nature of PHP'stime()
function and the slight delays between calculations, this could occasionally fail.The change modifies the test assertion to allow for a small tolerance (≤ 5 seconds) in the expiration time check, making the test more resilient while still maintaining its effectiveness in catching real issues.
There is an alternative approach by mocking
time
functions like in the server repo but I don't want to make it complicated, and this is still good to address the root cause.Testing instructions
npm run changelog
to add a changelog file, choosepatch
to leave it empty if the change is not significant. You can add multiple changelog files in one PR by running this command a few times.Post merge